package com.xc.quickstart.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xc.quickstart.infrastructure.ds.DataSource;
import com.xc.quickstart.infrastructure.ds.DataSourceEnum;
import com.xc.quickstart.mapper.entity.CrmConfigENT;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 通用配置表 Mapper 接口
 * </p>
 *
 * @author code generator
 * @since 2020-12-23
 */
@Repository
@DataSource(DataSourceEnum.TCPOI_WRITE)
public interface CrmConfigMapper extends BaseMapper<CrmConfigENT> {

    @DataSource(DataSourceEnum.TCPOI_READ)
    @Select(value = "select * from xc_crm_config where config_Key=#{key} and config_type=#{type} and is_valid != -1 limit 1")
    CrmConfigENT get(@Param("key") String key, @Param("type") String type);

    @DataSource(DataSourceEnum.TCPOI_READ)
    @Select(value = "select * from xc_crm_config where config_type=#{type} and is_valid != -1")
    List<CrmConfigENT> list(@Param("type") String type);

}
